/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.ControlInternalFrame;
import GUI.SavingBookManager.CustomerManager;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDesktopPane;
/**
 *
 * @author Nguyen Phi Hung
 */
public class JInterFrame_ControlManager extends javax.swing.JInternalFrame {
    
    private JDesktopPane desktop;
    /**
     * Creates new form JInterFrame_ControlManager
     */
    public JInterFrame_ControlManager() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        CustomerManager = new javax.swing.JButton();
        SavingBookManager = new javax.swing.JButton();
        ParamaterManager = new javax.swing.JButton();
        SangTypeManager = new javax.swing.JButton();

        setTitle("Nghiệp vụ quản lý");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${defaultCloseOperation}"), this, org.jdesktop.beansbinding.BeanProperty.create("closable"));
        bindingGroup.addBinding(binding);

        CustomerManager.setText("Quản lý Khách hàng");
        CustomerManager.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        CustomerManager.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CustomerManagerActionPerformed(evt);
            }
        });

        SavingBookManager.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/resource/btn_savingbookmanager.png"))); // NOI18N
        SavingBookManager.setText("Quản lý sổ tiết kiệm");
        SavingBookManager.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        SavingBookManager.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SavingBookManagerActionPerformed(evt);
            }
        });

        ParamaterManager.setText("Quản lý tham số");
        ParamaterManager.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

        SangTypeManager.setText("Quản lý loại tiết kiệm");
        SangTypeManager.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(SavingBookManager, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(CustomerManager, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)
                    .addComponent(ParamaterManager, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(SangTypeManager, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(SavingBookManager, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(CustomerManager, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(SangTypeManager, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(ParamaterManager, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(124, Short.MAX_VALUE))
        );

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void SavingBookManagerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SavingBookManagerActionPerformed
        // TODO add your handling code here:
        if(getDesktop().getComponentCount()!=0)
            getDesktop().getComponent(0).setVisible(false);
        getDesktop().removeAll();
        CustomerManager saving = null;
        try {
            saving = new CustomerManager();
        } catch (Exception ex) {
            Logger.getLogger(JInterFrame_ControlManager.class.getName()).log(Level.SEVERE, null, ex);
        }
        saving.setVisible(true);
        getDesktop().add(saving);        
    }//GEN-LAST:event_SavingBookManagerActionPerformed

    private void CustomerManagerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CustomerManagerActionPerformed
        // TODO add your handling code here:
        if(getDesktop().getComponentCount()!=0)
            getDesktop().getComponent(0).setVisible(false);
        getDesktop().removeAll();
        CustomerManager customer_manager = null;
        try {
            customer_manager = new CustomerManager();
        } catch (Exception ex) {
            Logger.getLogger(JInterFrame_ControlManager.class.getName()).log(Level.SEVERE, null, ex);
        }
        customer_manager.setVisible(true);
        getDesktop().add(customer_manager);   
  
    }//GEN-LAST:event_CustomerManagerActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton CustomerManager;
    private javax.swing.JButton ParamaterManager;
    private javax.swing.JButton SangTypeManager;
    private javax.swing.JButton SavingBookManager;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the desktop
     */
    public JDesktopPane getDesktop() {
        return desktop;
    }

    /**
     * @param desktop the desktop to set
     */
    public void setDesktop(JDesktopPane desktop) {
        this.desktop = desktop;
    }
}
